<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {

            $table->increments('id')->comment('用户ID');

            $table->string('name', 50)->comment('用户名');

            $table->string('mobile', 20)->comment('手机号');

            $table->string('email', 100)->nullable()->comment('邮箱');

            $table->string('password', 100)->nullable()->comment('密码');

            $table->string('avatar')->nullable()->comment('头像');

            $table->rememberToken();

            // 时间维护
            $table->timestamps();

            $table->unique('mobile');
            $table->unique('name');
            $table->unique('email');

            $table->comment = '用户表';

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
